package com.atguigu.edu2021.mock.bean;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 订单表 订单表
 * </p>
 *
 * @author zhangchen
 * @since 2021-09-05
 */
@Data
public class OrderInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 编号
     */
      @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 原始金额
     */
    private BigDecimal originAmount;

    /**
     * 优惠券减免
     */
    private BigDecimal couponReduce;

    /**
     * 最终金额
     */
    private BigDecimal finalAmount;

    /**
     * 订单状态
     */
    private String orderStatus;



    /**
     * 订单交易编号（第三方支付用)
     */
    private String outTradeNo;

    /**
     * 订单描述(第三方支付用)
     */
    private String tradeBody;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 失效时间
     */
    private Date expireTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 地区id
     */
    private Long provinceId;

    @TableField(exist= false)
    private List<OrderDetail> orderDetailList;


    /**
     * sessionId
     */
    private String sessionId;


    @Override
    public String toString() {
        return "OrderInfo{" +
        "id=" + id +
        ", userId=" + userId +
        ", originAmount=" + originAmount +
        ", couponReduce=" + couponReduce +
        ", finalAmount=" + finalAmount +
        ", orderStatus=" + orderStatus +
        ", outTradeNo=" + outTradeNo +
        ", tradeBody=" + tradeBody +
        ", createTime=" + createTime +
        ", expireTime=" + expireTime +
        ", updateTime=" + updateTime +
        "}";
    }




    public String getTradeInfo(){
        String body="";
        if(orderDetailList!=null&&orderDetailList.size()>0){
            body=  orderDetailList.get(0).getCourseName();
        }
        body+="等"+orderDetailList.size()+"件商品";
        return body;

    }
}
